package com.wty.gw.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wty.gw.util.PageParamReq;
import com.wty.gw.dao.UserMapper;
import com.wty.gw.model.Do.UserDO;
import com.wty.gw.model.query.UserQuery;
import com.wty.gw.service.UserService;
import com.wty.gw.model.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class UserServiceImpl implements UserService{

	@Autowired
    private UserMapper userMapper;

    @Override
    public void add(UserDO userDo) {
        userMapper.insert(userDo);
    }

    @Override
    public void delete(Long id) {
        userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void update(UserDO userDo) {
        userMapper.updateByPrimaryKeySelective(userDo);
    }

    @Override
    public PageInfo<UserVo> listByPage(UserQuery userQuery) {
        PageHelper.startPage(userQuery.getPageNo(), userQuery.getPageSize());

        return new PageInfo(userMapper.listBycompanyId(userQuery));
    }

    @Override
    public UserDO get(Long id) {
        return userMapper.selectByPrimaryKey(id);
    }
	
	
	
	
	
	
}